import 'package:flutter/material.dart';
import 'package:flutter_app/components/layout.dart';
import 'package:flutter_app/components/no-record.dart';

class InviteRecordPage extends StatefulWidget {
  @override
  _InviteRecordPageState createState() => _InviteRecordPageState();
}

class _InviteRecordPageState extends State<InviteRecordPage> {
  int active=0;
  void changeActive(int c){
    setState(() {
      active=c;
    });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        brightness: Brightness.dark,
        backgroundColor: Colors.blueAccent[400],
        elevation: 0,
        title: Container(
          height: 40,
          width: 220,
          padding: EdgeInsets.symmetric(vertical: 2, horizontal: 2),
          decoration: BoxDecoration(
              color: Colors.black.withOpacity(0.1),
              borderRadius: BorderRadius.circular(20)),
          child: Row(
            children: [
              Expanded(
                child: FlatButton(
                    onPressed: () {changeActive(0);},
                    shape: StadiumBorder(),
                    textColor: active==0 ? Colors.blue:Colors.white.withOpacity(0.8),
                    color: active==0?Colors.white:Colors.transparent,
                    child: Text(
                      '邀请记录',
                    )
                ),
              ),
              Expanded(
                child: FlatButton(
                    onPressed: () {changeActive(1);},
                    shape: StadiumBorder(),
                    color: active==1?Colors.white:Colors.transparent,
                    textColor: active==1?Colors.blue:Colors.white.withOpacity(0.8),
                    child: Text(
                      '返佣记录',
                    )
                ),
              )
            ],
          ),
        ),
      ),
      body: Container(
        child: Column(
          children: [
            Container(
              width: MediaQuery.of(context).size.width,
              padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 20.0),
              color: Colors.blueAccent[400],
              child: ColumnStart(
                children: [
                  Offstage(
                    offstage: active==1,
                    child: Row(
                      children: [
                        Expanded(
                          child: Column(
                            children: [
                              Text('已邀请注册人数',
                                  style: TextStyle(
                                      color: Colors.white.withOpacity(0.5))),
                              Text(
                                '0',
                                style:
                                    TextStyle(color: Colors.white, fontSize: 26),
                              ),
                            ],
                          ),
                        ),
                        Expanded(
                          child: Column(
                            children: [
                              Text('已购买人数',
                                  style: TextStyle(
                                      color: Colors.white.withOpacity(0.5))),
                              Text(
                                '0',
                                style:
                                    TextStyle(color: Colors.white, fontSize: 26),
                              ),
                            ],
                          ),
                        )
                      ],
                    ),
                  ),
                  Offstage(
                    offstage: active==0,
                    child: Row(
                      children: [
                        Expanded(
                          child: Column(
                            children: [
                              Text('已赚返佣',
                                  style: TextStyle(
                                      color: Colors.white.withOpacity(0.5))),
                              Row(
                                mainAxisAlignment: MainAxisAlignment.center,
                                // crossAxisAlignment: CrossAxisAlignment.end,
                                children: [
                                  Text(
                                    '0',
                                    style:
                                    TextStyle(color: Colors.white, fontSize: 26),
                                  ),
                                  Text(' USDT',style: TextStyle(color: Colors.white,fontSize: 20),)
                                ],
                              ),
                            ],
                          ),
                        ),
                        Expanded(
                          child: Column(
                            children: [
                              Text('已到账',
                                  style: TextStyle(
                                      color: Colors.white.withOpacity(0.5))),
                              Row(
                                mainAxisAlignment: MainAxisAlignment.center,
                                // crossAxisAlignment: CrossAxisAlignment.end,
                                children: [
                                  Text(
                                    '0',
                                    style:
                                    TextStyle(color: Colors.white, fontSize: 26),
                                  ),
                                  Text(' USDT',style: TextStyle(color: Colors.white,fontSize: 20),)
                                ],
                              ),
                            ],
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 20,
                  ),
                  Center(
                      child: Text(
                    '完成KYC2后，每天20:00(UTC+8)自动结算',
                    style: TextStyle(color: Colors.white.withOpacity(0.5)),
                  ))
                ],
              ),
            ),
            Expanded(child: NoRecord())
          ],
        ),
      ),
    );
  }
}
